-
Notifications
You must be signed in to change notification settings - Fork 633
Toby cookbook lines #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toby cookbook lines #196
Conversation
fixing the one test that failed turned out to more complicated than I imagined. I made some non-trivial changes which I will try to explain inline. please code review @mkcor @chriddyp @cpsievert |
if(p$layers[[layer.i]]$inherit.aes){ | ||
to.copy <- names(p$mapping)[!names(p$mapping) %in% names(layer.aes)] | ||
layer.aes[to.copy] <- p$mapping[to.copy] | ||
} | ||
mark.names <- markUnique[markUnique %in% names(layer.aes)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some geoms (like hline and vline) need to ignore the global aes mapping.
http://ropensci.github.io/plotly-test-table/tables/8e68d8abfe1137ac265e8c80f92502b3fa3c7892/big.html shows some untested regressions. I will add tests and make the fixes. |
still need to fix these test failures
|
Also I'm wondering if anybody has ideas about how to best translate this to plotly? |
all the tests I wrote pass now, but there are still the visual problems I mentioned above which I am not sure how to convert to plotlys. Any ideas? |
It seems like those bar lines are a ggplot2 error bars hack.
At some point, Option 1 - Attaching them to invisible bar traces
Cons
Option 2 - Making them separate line objects
Cons
Here's an example with lines, and {
'data': [
{
'x': ['Cats', 'Dogs'],
'y': [4, 6],
'type': 'bar',
'name': 'Series 1'
},
{
'x': ['Cats', 'Dogs'],
'y': [5, 7],
'type': 'bar',
'name': 'Series 2'
}
],
'layout': {
'bargap': 0,
'shapes': [
{
'type': 'line',
'x0': -0.5,
'x1': 0.5,
'y0': 4.5,
'y1': 4.5,
'line': {
'color': 'blue',
'width': 4,
'dash': 'dash'
}
},
{
'type': 'line',
'x0': 0.5,
'x1': 1.5,
'y0': 5.5,
'y1': 5.5,
'line': {
'color': 'red',
'width': 4,
'dash': 'dot'
}
},
{
'type': 'line',
'x0': 0.5,
'x1': 1,
'y0': 6.5,
'y1': 6.5,
'line': {
'color': 'green',
'width': 4,
'dash': 'dashdot'
}
},
{
'type': 'line',
'x0': 0,
'x1': 0.5,
'y0': 7.0,
'y1': 7.0,
'line': {
'color': 'orange',
'width': 4,
'dash': 'solid'
}
}
]
}
} So, it seems like keeping them as invisible error bars and increasing the error bar width might be the easiest thing to do right now. If/when we error bar widths relative to error bar widths, this'll be really straightforward. |
@@ -358,8 +363,7 @@ toBasic <- list( | |||
g | |||
}, | |||
bar=function(g) { | |||
if (any(is.na(g$prestats.data$x))) | |||
g$prestats.data$x <- g$prestats.data$x.name | |||
## TODO: why is this here? bar is a basic geom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess a 'git blame' would help tracing this back.
I agree it looks non-robust. I remember doing this so that popular use cases convert well...
Hi @tdhock sorry for not being on R lately... Thanks for this work. I believe all the |
@cpsievert I think the errorbars are green in the Funnily enough, we haven't bothered (yet) with the first default colour, which is black in |
@mkcor good to know, I've noticed the default color/fill are different on several tests. If you them to match, just say the word and I'll take care of it :) |
On TravisCI, commit 9ab52e1 was successfully merged with d9ecaf4 (master) to create 9abb9de. A visual testing table comparing d9ecaf4 with 9abb9de can be found here: |
@cpsievert Okay, looking now. I'm confused though, because files |
Yea, they were edited before I merged with master, so I had to resolve those conflicts... |
for(a in legends.present){ | ||
if(is.hidden(p$guides[[a]])){ | ||
layout$showlegend <- FALSE | ||
} | ||
} | ||
|
||
# Legend hiding from theme. | ||
if(theme.pars$legend.position=="none"){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces at least around ==
and between ) {
.
@cpsievert [default color/fill] No, thanks. Blue looks better, plus we've never heard anybody complain about it. ;) |
@cpsievert Okay... But "5 May 2015" lies in the future so... How can it be something we would want or something we would get from somewhere? |
On TravisCI, commit d142570 was successfully merged with f4bc6b9 (master) to create 1cf9b72. A visual testing table comparing f4bc6b9 with 1cf9b72 can be found here: |
I'll pull this branch and do the stylistic fixes. |
@cpsievert Let either of us +1 and the other will merge... |
You mean, turn off (unchecking the box)? You're right, I always left this box unchecked so I assumed it was RStudio's default. We've had this conversation in the past: #151 (comment) and subsequent comments. |
Oh, yes, sorry, I must've not edited/saved those files, so they were still left over from Toby's commits. |
On TravisCI, commit 4cfedf9 was successfully merged with ae947fc (master) to create 0832b38. A visual testing table comparing ae947fc with 0832b38 can be found here: |
Looks good! +1 |
I had to restart one of the builds due to a silly Travis error, but this is good to go, please merge @mkcor 👍 |
I added some tests based on https://github.com/ropensci/plotly/blob/add-r-cookbook-tests/tests/cookbook-test-suite/lines.R
one test doesn't pass, and I'm working on fixing it.